import bs4,requests
res = requests.get('https://nostarch.com/')
res.raise_for_status()
#将相应结果的text属性传递给bs4.BeautifulSoup，返回BeautifulSoup对象保存在变量noStarchSoup中
noStarchSoup = bs4.BeautifulSoup(res.text,'html.parser')#指定解析器
type(noStarchSoup)
exampleFile = open('example.html')
exampleSoup = bs4.BeautifulSoup(exampleFile,'html.parser')
type(exampleSoup)